package nicepc.tools.kafka;

import nicepc.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.messaging.MessageHeaders;
import org.springframework.messaging.handler.annotation.Headers;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Service;

//消费
//@Service
public class Receiver {

//    @Autowired
//    RedisTemplate redisTemplate;

//    @KafkaListener(topics = "${app.topic.foo1}")
//    public void receive(@Payload String message, @Headers MessageHeaders headers) {
//        ValueOperations ops = redisTemplate.opsForValue();
//        ops.set("receive", message);
//        System.out.println(("接收" + message));
//        System.out.println(message);
//    }
}
